/**
 * Project Name:sc-pay-service
 * File Name:PayService.java
 * Package Name:com.sc.test.pay
 * Date:2016��12��13������10:09:21
 * Copyright (c) 2016, ����֪ʱ��Ϣ�Ƽ����޹�˾ All Rights Reserved.
 *
*/

package com.sc.test.pay;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.discovery.converters.Auto;

/**
 * ClassName:PayService <br/>
 * Function: <br/>
 * Date: 2016��12��13�� ����10:09:21 <br/>
 * 
 * @author guooo
 * @version
 * @since JDK 1.6
 * @see
 */
@RestController
public class PayServiceController {

    private final Logger logger = Logger.getLogger(getClass());

    @Autowired
    private DiscoveryClient client;

    /**
     * pay: <br/>
     *
     * @author guooo
     * Date:2016年12月13日上午10:21:40
     * @param orderID
     * @return
     * @since JDK 1.6
     */
    @RequestMapping(value = "pay", method = {RequestMethod.GET})
    public String pay(String orderID) {
        ServiceInstance instance = client.getLocalServiceInstance();
        logger.info("/add, host:" + instance.getHost() + ", service_id:" + instance.getServiceId());
        return "hello " + orderID;
    }
}
